package com.dragon.rabbitmq.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dragon.rabbitmq.CoreServiceProduct;
import com.marvels.approve.mqueues.service.impl.ApproveLoanApplyMqReciever;
import com.marvels.common.utils.MarvelsLogUtil;
 
@Service
public class CoreServiceProductImpl implements CoreServiceProduct {
	@Autowired
    private ApproveLoanApplyMqReciever approveLoanApplyMqReciever;
	
	@Override
	public void sendLoanApplyMessage(String loanId) throws Exception {
		//将新进件的loanId推送到MQ
		MarvelsLogUtil.getInstance().info("将新进件的loanId推送到MQ:"+loanId);
		try {
			approveLoanApplyMqReciever.onMessage(loanId);
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("将新进件的loanId推送到MQ错误loanId:"+loanId,e);
		}
	} 
	
	/*private void sendMessage(String queueName,String content) {
		rabbitTemplate.convertAndSend(queueName,content);
	}*/
}
